package com.ViewModel;

import com.BaseDeDatos.Conexion;
import com.Model.Comida;

import gueei.binding.Binder;
import gueei.binding.Command;
import gueei.binding.collections.ArrayListObservable;
import gueei.binding.observables.IntegerObservable;
import gueei.binding.observables.StringObservable;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.Toast;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;

@SuppressLint("ShowToast")
public class GridViewModel extends Activity {


	
	
	 public Command LlenarImagenes = new Command(){
	    	public void Invoke(View arg0,Object... arg1){
	    		MostrarImagen();
	    	}
	    	
	    };
	    
	    private void MostrarImagen()
	    {
	    	GridView grGrid =(GridView)findViewById(R.id.gridView1);
	    	grGrid.setAdapter(new ImageAdapter(getApplicationContext()));
	    	grGrid.setOnItemClickListener(new OnItemClickListener(){
	    	public void onItemClick(AdapterView<?>parentView,View iv , int position,
	    			long id){
	    		Toast.makeText(getApplicationContext(), ""+position, Toast.LENGTH_SHORT).show();
	    	//	Intent i= new Intent(getApplicationContext(),  ImageDetailViewModel.class);
	    		//i.putExtra("id",position);
	    		
	    	}
	    	});
	    	
	    	
	    }
	   @SuppressWarnings("deprecation")
		@Override
		public void onCreate(Bundle savedInstanceState) {
	    	super.onCreate(savedInstanceState);
	    	
	    	Binder.setAndBindContentView(this, R.layout.grid_view, this);
	    }
}
